import {req_get_auth, req_post_auth, req_get} from "./axiosFun.js";
import {HOST} from '@/api/hosts'

export const getAllUsers = (params) => {
    const url = `${HOST}/users/page`;
    return req_get_auth("get", url, params);
};

export const listUsers = (params) => {
    const url = `${HOST}/users`;
    return req_get_auth("get", url, params);
};
export const addUser = (data) => {
    const url = `${HOST}/users`;
    return req_post_auth("post", url, data);
};

export const deleteUser = (id) => {
    const url = `${HOST}/users/${id}`;
    return req_post_auth("delete", url);
};

export const updateUser = (data) => {
    const url = `${HOST}/users`;
    return req_post_auth("put", url, data);
};

export const login = (params) => {
    const url = `${HOST}/users/login`;
    return req_get("get", url, params);
};
export const getUserInfo = (params) => {
    const url = `${HOST}/users/userInfo`;
    return req_get_auth("get", url, params);
};